package com.qfmy.web.app.controller.conmon;



import com.qfmy.common.result.Result;
import com.qfmy.web.app.service.conmon.FileUploadService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author 清风明月
 * @Package com.qfmy.web.app.controller.user
 * @date 2025/9/10
 * @description 文件上传
 */
@RequestMapping("/app/file")
@RestController
@SuppressWarnings("all")
public class FileUploadController {

	/**
	 * 注入文件上传服务
	 */
	@Resource
	private FileUploadService fileUploadService;

	/**
	 *文件上传方法
	 */
	@PostMapping("/upload")
	public Result<String> upload(@RequestParam MultipartFile file) throws Exception {
		// 上传文件
		String url = fileUploadService.upload(file);
		return Result.ok(url);
	}

}
